#!/usr/bin/env python3
# -*- coding:utf-8 -*-

# 导入语句的区别
# 单独运行下面例子,体会区别
"""
import functools # 导入模块
print(dir())
print(functools)
print(functools.wraps)
"""
"""
import os.path  # 导入os.path, os加入当前名词空间
print(dir())
print(os)
print(os.path) # 完全限定名称访问path
"""

"""
import os.path as osp  # 导入os.path并赋给osp
print(dir())
print(osp)
"""

# from语句
"""
from pathlib import Path,PosixPath # 在当前名词空间导入该模块指定的成员
print(dir())

from pathlib import * # 在当前名词空间导入该模块所有公共成员(非下划线开头成员)或指定成员.
print(dir())

from functools import wraps as wr,partial  # 别名
print(dir())

from os.path import exists  # 加载,初始化os,os.path模块,exists加入本地名词空间并绑定.

if exists('/abc'):
    print('Found')
else:
    print('Not Found')

print(dir())
print(exists)

import os 

print(os.path.exists)
print(exists)
print(os.path.__dict__['exists'])
print(getattr(os.path,'exists'))
# 上面4种方式获得同一个对象.
"""

### 自定义模块
print('This is test module')

class A:
    def showmodule(self):
        print("{}.a = {}".format(self.__module__,self))
        print(self.__class__.__name__)

a = A()
a.showmodule()


